<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" import="java.util.Map,java.util.List,com.wit.dao.impl.EmployeeDaoImpl,com.wit.po.Clientlevel,com.wit.dao.impl.ClientlevelDaoImpl,com.wit.dao.impl.ClientDaoImpl" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>客户新增</title>
<link href="../style/main.css" rel="stylesheet" type="text/css" />
<link type="text/css" rel="stylesheet" href="../style/style.css" />
<link rel="stylesheet" href="../style/ui.datepicker.css" type="text/css" media="screen" title="core css file" charset="utf-8" />
<script src="../js/jquery.js" type="text/javascript"></script>
<script src="../js/ui.datepicker.js" type="text/javascript" charset="gbk"></script>
<%@ taglib prefix="s" uri="/struts-tags" %>

<script type="text/javascript">
	function getTop(e){ 
		var offset=e.offsetTop; 
		if(e.offsetParent!=null) offset+=getTop(e.offsetParent); 
		return offset; 
	} 
	//获取元素的横坐标 
	function getLeft(e){ 
		var offset=e.offsetLeft; 
		if(e.offsetParent!=null) offset+=getLeft(e.offsetParent); 
		return offset; 
	}
	function showTree(e)
	{
		var top = getTop(e);
		var left = getLeft(e);
		var obj = document.getElementById("showTreeDiv");
		if(obj.innerHTML == null || obj.innerHTML.length <= 0)
			obj.innerHTML = "<html><iframe id=\"editIFrame\" frameborder=\"0\" src=\"area_select.jsp\" scrolling=\"yes\" width=\"300\" height=\"300\"></iframe></html>";
		obj.style.left=left;
		obj.style.top = top;
		obj.style.display="";
	}
	function addNewClient()
	{
		var objs = document.getElementsByTagName("input");
		for(i=0;i<objs.length;i++)
		{
			if(objs[i].value == null || objs[i].value.length <= 0)
			{
				alert("客户信息不完整");
				return;
			}
		}
		clientInfoForm.submit();
	}
	 $(function(){
    jQuery(function($){
		$.datepicker.regional['zh-CN'] = {clearText: '清除', clearStatus: '清除已选日期',
		closeText: '关闭', closeStatus: '不改变当前选择',
		prevText: '&lt;上月', prevStatus: '显示上月',
		nextText: '下月&gt;', nextStatus: '显示下月',
		currentText: '今天', currentStatus: '显示本月',
		monthNames: ['一月','二月','三月','四月','五月','六月',
		'七月','八月','九月','十月','十一月','十二月'],
		monthNamesShort: ['一','二','三','四','五','六',
		'七','八','九','十','十一','十二'],
		monthStatus: '选择月份', yearStatus: '选择年份',
		weekHeader: '周', weekStatus: '年内周次',
		dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
		dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
		dayNamesMin: ['日','一','二','三','四','五','六'],
		dayStatus: '设置 DD 为一周起始', dateStatus: '选择 m月 d日, DD',
		dateFormat: 'yy-mm-dd', firstDay: 1, 
		yearRange:'-10,+10',
		initStatus: '请选择日期', isRTL: false};
	$.datepicker.setDefaults($.datepicker.regional['zh-CN']);
				$("#borndate").datepicker();
				$("#Activedate").datepicker();
			    $("#djdata").datepicker();
			});
  });
</script>
<%
	Map map = EmployeeDaoImpl.s_GetEmployeeNameList();
	List<Clientlevel> levelList = ClientlevelDaoImpl.s_GetClientlevelList();
	if(levelList == null || levelList.size() == 0)
	{
%>
<script type="text/javascript">
	alert("没有客户级别列表信息，请先添加");
	document.location = "clientlevel_new.jsp";
</script>
<%
		return;
	}
	String clientId = ClientDaoImpl.s_GenerateClientId();
	request.setAttribute("clientId",clientId);
	request.setAttribute("levelList",levelList);
	request.setAttribute("employeeMap",map);
%>
</head>

<body>

<div id="showTreeDiv" style="display:none; position:absolute"></div>

<table width="1000" cellpadding="0" cellspacing="0" class="table">
  <tr>
    <td>
      <table width="100%" cellpadding="0" cellspacing="0" class="table2">
        <tr>
          <td valign="top">

        <div class="mainarea">
          <div class="search" style="padding:10px">
            <s:form name="clientInfoForm" action="clientInfo!addClient" method="post" theme="simple">
              <table cellpadding="0" cellspacing="0" width="100%" class="table4">
                  <tr>
                    <th height="25" colspan="4" bgcolor="#BBD2F7" class="title">客户基本信息</th>
                  </tr>
                  <tr>
                    <th width="103"> 客户编号： </th>
                    <td width="347">
                    	<s:textfield name="client.clientId" value="%{client==null?#request.clientId:client.clientId}" required="true" title="当输入的编号无效时，将使用系统生成的编号！"></s:textfield>
                    </td>
                    <th width="79"> 客户名称： </th>
                    <td width="425"><s:textfield name="client.clientName"></s:textfield>* </td>
                  </tr>
                  <tbody id="tbody_2" >
                    <tr>
                      <th height="19"> 客户类别：</th>
                      <td><s:select name="client.clientType" list="{'个人','团体'}">
                      	  </s:select>
                      </td>
                      <th>性&nbsp;&nbsp;&nbsp;&nbsp;别：</th>
                      <td>
                        <s:select name="client.clientSex" list="{'男','女'}">
                      	</s:select>
                      </td>
                    </tr>
                    <tr> 
                      <th>证件类型：</th>
                      <td><s:select name="client.cardType" list="{'身份证','户口本','企业注册号','护照','军人证'}"></s:select></td>
                      <th>生&nbsp;&nbsp;&nbsp;&nbsp;日：</th>
                      <td>
                      	<s:textfield name="client.clientBorndate" cssStyle="width: 60px" id="borndate">
                      		<s:param name="value"><s:date name="client.clientBorndate" format="yyyy-MM-dd"/></s:param>
                      	</s:textfield>
                      </td>
                    </tr>
                      <tr>
                      <th>证件号码：</th>
                      <td><s:textfield name="client.clientIdcard"></s:textfield>* </td>
                      <th>有效日期：</th>
                      <td>
                      	<s:textfield name="client.activeToDate" cssStyle="width: 60px" id="Activedate">
                      		<s:param name="value"><s:date name="client.activeToDate" format="yyyy-MM-dd"/></s:param>
                      	</s:textfield>
                      </td>
                    </tr>
                    <tr>
                      <th>所属地区：</th>
                      <td>
                      	<s:textfield onclick="javascript:showTree(this);" id="areaId" name="client.area.areaId"></s:textfield>
                      </td>
                      <th> 手&nbsp;&nbsp;&nbsp; 机： </th>
                      <td><s:textfield name="client.clientPhone"></s:textfield>* </td>
                    </tr>
                    <tr>
                      <th height="19"> 客户级别：</th>
                      <td>
                   		<s:select name="client.clientlevel.clientlevelId" 
                   					list="#request.levelList" listKey="clientlevelId" listValue="clmemo" >
                   		</s:select>
                      </td>
                      <th>业 务 员： </th>
                      <td>
                      	  <s:select name="client.employee.employeeId" 
                      	  				list="#request.employeeMap" listKey="key" listValue="value">
                      	  </s:select>
                      </td>
                    </tr>
                  </tbody>
                  <tr>
                    <th>行业类型：</th>
                    <td>
						<s:select name="client.clientIndustry" 
									list="{'金融','服务','地产','保险'}">
						</s:select>
                    </td>
                    <th>客户电话：</th>
                    <td><s:textfield name="client.clienttelephone"></s:textfield>* </td>
                  </tr>
                  <tr>
                    <th>通信地址：</th>
                    <td><s:textfield name="client.clientAddress"></s:textfield></td>
                    <th>传&nbsp;&nbsp;&nbsp;&nbsp;真：</th>
                    <td><s:textfield name="client.clientfax"></s:textfield></td>
                  </tr>
                  <tr>
                    <th>电子邮件：</th>
                    <td><s:textfield name="client.clientemail"></s:textfield></td>
                    <th>邮&nbsp;&nbsp;&nbsp;&nbsp;编：</th>
                    <td><s:textfield name="client.clientPostcode"></s:textfield></td>
                  </tr>
                  <tr>
                    <th>开户银行：</th>
                    <td><s:textfield name="client.cbank"></s:textfield></td>
                    <th>银行账号：</th>
                    <td><s:textfield name="client.caccount"></s:textfield></td>
                  </tr>
                  <tr>
                    <th>工作单位：</th>
                    <td><s:textfield name="client.workCompany"></s:textfield></td>
                    <th>婚姻状况：</th>
                    <td> <s:select name="client.maryState" list="{'已婚','未婚','离异'}">
                      	</s:select></td>
                  </tr>	
                   <tr>
                    <th>职位名称：</th>
                    <td><s:textfield name="client.positionName"></s:textfield></td>
                    <th>最高学历：</th>
                    <td> <s:select name="client.eduState" list="{'本科','小学','初中','高中','大专','硕士','博士'}">
                      	</s:select></td>
                  </tr>
                    <tr>
                    <th>国籍：</th>
                    <td><s:textfield name="client.countyBook"></s:textfield></td>
                    <th>户籍：</th>
                    <td><s:textfield name="client.stateBook"></s:textfield></td>
                  </tr>
                    <tr>
                    <th>户籍地址：</th>
                    <td><s:textfield name="client.stateBookadd"></s:textfield></td>
                    <th>登记日期：</th>
                    <td>
                        <s:textfield name="client.addDate" cssStyle="width: 60px" id="djdata">
                      		<s:param name="value"><s:date name="client.addDate" format="yyyy-MM-dd"/></s:param>
                      	</s:textfield>
                    </td>
                  </tr>
                  <tr>
                    <th colspan="4">&nbsp;</th>
                  </tr>
                </table>
                <table cellpadding="0" cellspacing="0" width="100%" class="table5">
                  <tr>
                    <th height="25" colspan="2" bgcolor="#BBD2F7" class="title">附加信息</th>
                  </tr>
                  <tr>
                    <th valign="top"  class="fjxx_left"> 背景资料： </th>
                    <td width="1103">
                    	<s:textarea name="client.cbackg" id="cbackg" cols="45" rows="5" class="fjxx"></s:textarea>
                    </td>
                  </tr>
                  <tbody id="tbody_3" >
                    <tr>
                      <th height="19" valign="top" class="fjxx_left"> 兴趣爱好：</th>
                      <td>
                      	<s:textarea name="client.chobby" id="chobby" cols="45" rows="5" class="fjxx"></s:textarea>
                      </td>
                    </tr>
                    <tr>
                      <th valign="top" class="fjxx_left">备&nbsp;&nbsp;&nbsp;&nbsp;注：</th>
                      <td>
                      	<s:textarea name="client.clmemo" id="clmemo" cols="45" rows="5" class="fjxx"></s:textarea>
                      </td>
                    </tr>
                                        <tr>
                      <th valign="top" class="fjxx_left">风险资料：</th>
                      <td>
                      	<s:textarea name="client.risk" id="risk" cols="45" rows="5" class="fjxx"></s:textarea>
                      </td>
                    </tr>
                  </tbody>
                </table>
                <table width="100%" cellpadding="0" cellspacing="0"class="table3">
                    <tr>
                        <td width="6%" class="title">&nbsp;</td>
                        <td width="5%" ></td>
                        <td width="5%" >&nbsp;</td>
                        <td width="5%" >&nbsp;</td>
                        <td width="5%" >&nbsp;</td>
                        <td width="5%" >&nbsp;</td>
                        <td width="5%" >&nbsp;</td>
                        <td width="8%" >
                        	<a onclick="javascript:addNewClient();" href="javascript:void(0);"><span class="clientinfo_but">保&nbsp;存</span></a>
                        </td>
                        <td width="5%" ><span class="clientinfo_but">取&nbsp;消</span></td>
                        <td width="13%" ></td>  
                        <td width="19%" >&nbsp;</td>
                    </tr>
                </table>
            </s:form>

            </div>

        </div>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

</body>
</html>
